using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace WIT.DAQ.Core.Forms.UserControls;

/// <summary>
///
/// </summary>
internal class UC_DAQItemParams_For_OPCUA : UserControl
{
	/// <summary>
	/// NodeId
	/// </summary>
	internal string NODEID = string.Empty;

	/// <summary> 
	/// 必需的设计器变量。
	/// </summary>
	private IContainer components = null;

	private Label label1;

	private TextBox txtNodeId;

	private Label label2;

	private Label lblNotice;

	private Label label3;

	private Label label4;

	private Label label5;

	private GroupBox groupBox1;

	/// <summary>
	///
	/// </summary>
	internal UC_DAQItemParams_For_OPCUA()
	{
		InitializeComponent();
	}

	/// <summary>
	///
	/// </summary>
	/// <param name="nodeId"></param>
	internal UC_DAQItemParams_For_OPCUA(string nodeId)
	{
		InitializeComponent();
		NODEID = nodeId;
		txtNodeId.Text = NODEID;
	}

	/// <summary>
	/// 校验输入的内容是否合法
	/// </summary>
	/// <returns></returns>
	internal bool ValidateInputs(out string msg)
	{
		msg = string.Empty;
		bool flag = false;
		try
		{
			NODEID = txtNodeId.Text.Trim();
			if (string.IsNullOrEmpty(NODEID))
			{
				throw new Exception("请输入正确的NodeId");
			}
			flag = true;
		}
		catch (Exception ex)
		{
			flag = false;
			msg = ex.Message;
		}
		return flag;
	}

	/// <summary> 
	/// 清理所有正在使用的资源。
	/// </summary>
	/// <param name="disposing">如果应释放托管资源，为 true；否则为 false。</param>
	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	/// <summary> 
	/// 设计器支持所需的方法 - 不要修改
	/// 使用代码编辑器修改此方法的内容。
	/// </summary>
	private void InitializeComponent()
	{
		this.label1 = new System.Windows.Forms.Label();
		this.txtNodeId = new System.Windows.Forms.TextBox();
		this.label2 = new System.Windows.Forms.Label();
		this.lblNotice = new System.Windows.Forms.Label();
		this.label3 = new System.Windows.Forms.Label();
		this.label4 = new System.Windows.Forms.Label();
		this.label5 = new System.Windows.Forms.Label();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.groupBox1.SuspendLayout();
		base.SuspendLayout();
		this.label1.AutoSize = true;
		this.label1.ForeColor = System.Drawing.Color.Red;
		this.label1.Location = new System.Drawing.Point(417, 38);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(17, 12);
		this.label1.TabIndex = 30;
		this.label1.Text = "* ";
		this.txtNodeId.Location = new System.Drawing.Point(111, 35);
		this.txtNodeId.Name = "txtNodeId";
		this.txtNodeId.Size = new System.Drawing.Size(300, 21);
		this.txtNodeId.TabIndex = 0;
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(58, 38);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(47, 12);
		this.label2.TabIndex = 29;
		this.label2.Text = "NodeId:";
		this.lblNotice.AutoSize = true;
		this.lblNotice.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.lblNotice.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.lblNotice.Location = new System.Drawing.Point(109, 69);
		this.lblNotice.Name = "lblNotice";
		this.lblNotice.Size = new System.Drawing.Size(269, 12);
		this.lblNotice.TabIndex = 35;
		this.lblNotice.Text = "注：SIEMENS S1200系列无法直接读取结构体/数组";
		this.label3.AutoSize = true;
		this.label3.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.label3.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.label3.Location = new System.Drawing.Point(6, 19);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(299, 12);
		this.label3.TabIndex = 35;
		this.label3.Text = "SIEMENS S1500：ns=3;s=\"DataBlock\".\"Struct\".\"xxxx\"";
		this.label4.AutoSize = true;
		this.label4.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.label4.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.label4.Location = new System.Drawing.Point(6, 55);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(215, 12);
		this.label4.TabIndex = 35;
		this.label4.Text = "OMRON NJ：ns=4;s=Struct.Struct.xxxx";
		this.label5.AutoSize = true;
		this.label5.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.label5.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.label5.Location = new System.Drawing.Point(6, 37);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(407, 12);
		this.label5.TabIndex = 35;
		this.label5.Text = "SIEMENS S1200：ns=4;i=编号（PLC自动生成，在ServerInterfaces中查看）";
		this.groupBox1.Controls.Add(this.label3);
		this.groupBox1.Controls.Add(this.label4);
		this.groupBox1.Controls.Add(this.label5);
		this.groupBox1.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.groupBox1.Location = new System.Drawing.Point(60, 84);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Size = new System.Drawing.Size(438, 93);
		this.groupBox1.TabIndex = 36;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "examples";
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.Controls.Add(this.groupBox1);
		base.Controls.Add(this.lblNotice);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.txtNodeId);
		base.Controls.Add(this.label2);
		base.Name = "UC_DAQItemParams_For_OPCUA";
		base.Size = new System.Drawing.Size(523, 180);
		this.groupBox1.ResumeLayout(false);
		this.groupBox1.PerformLayout();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
